var userAgent = navigator.userAgent

function userAgentMatch(regex) {
    return userAgent.match(regex) !== null
}

function isAndroid() {
    return userAgentMatch(/Android/i) && !userAgentMatch(/Windows Phone/i)
}

function isTbsX5() {
    var ua = userAgent
    var res

    if (!isAndroid(ua)) {
        return false
    }
    res = /tbs\/(\d+) /gi.exec(ua)
    if (res) {
        return (res[1] || '') > '036849'
    }
    return false
}

function isQQX5() {
    var ua = userAgent
    var res

    if (!isAndroid(ua)) {
        return false
    }
    res = /MQQBrowser\/([\d+.]+) /gi.exec(ua)
    if (res) {
        return +(res[1] || '') >= 7.1
    }
    return false
}

function isX5() {
    return isTbsX5() || isQQX5()
}